home *** CD-ROM | disk | FTP | other *** search
/ Chip 2007 January, February, March & April / Chip-Cover-CD-2007-02.iso / Pakiet bezpieczenstwa / mini Pentoo LiveCD 2006.1 / mpentoo-2006.1.iso / livecd.squashfs / usr / lib / mozilla-firefox / include / xpcom / nsLocalFile.h < prev    next >
C/C++ Source or Header  |  2006-05-08  |  5KB  |  119 lines

  1. /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
  2. /* ***** BEGIN LICENSE BLOCK *****
  3.  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
  4.  *
  5.  * The contents of this file are subject to the Mozilla Public License Version
  6.  * 1.1 (the "License"); you may not use this file except in compliance with
  7.  * the License. You may obtain a copy of the License at
  8.  * http://www.mozilla.org/MPL/
  9.  *
  10.  * Software distributed under the License is distributed on an "AS IS" basis,
  11.  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
  12.  * for the specific language governing rights and limitations under the
  13.  * License.
  14.  *
  15.  * The Original Code is Mozilla Communicator client code, released
  16.  * March 31, 1998.
  17.  *
  18.  * The Initial Developer of the Original Code is
  19.  * Netscape Communications Corporation.
  20.  * Portions created by the Initial Developer are Copyright (C) 1998-1999
  21.  * the Initial Developer. All Rights Reserved.
  22.  *
  23.  * Contributor(s):
  24.  *
  25.  * Alternatively, the contents of this file may be used under the terms of
  26.  * either of the GNU General Public License Version 2 or later (the "GPL"),
  27.  * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
  28.  * in which case the provisions of the GPL or the LGPL are applicable instead
  29.  * of those above. If you wish to allow use of your version of this file only
  30.  * under the terms of either the GPL or the LGPL, and not to allow others to
  31.  * use your version of this file under the terms of the MPL, indicate your
  32.  * decision by deleting the provisions above and replace them with the notice
  33.  * and other provisions required by the GPL or the LGPL. If you do not delete
  34.  * the provisions above, a recipient may use your version of this file under
  35.  * the terms of any one of the MPL, the GPL or the LGPL.
  36.  *
  37.  * ***** END LICENSE BLOCK *****
  38.  *
  39.  * This Original Code has been modified by IBM Corporation. Modifications made by IBM 
  40.  * described herein are Copyright (c) International Business Machines Corporation, 2000.
  41.  * Modifications to Mozilla code or documentation identified per MPL Section 3.3
  42.  *
  43.  * Date             Modified by     Description of modification
  44.  * 04/20/2000       IBM Corp.      OS/2 build.
  45.  */
  46.  
  47. #ifndef _NS_LOCAL_FILE_H_
  48. #define _NS_LOCAL_FILE_H_
  49.  
  50. #define NS_LOCAL_FILE_CID {0x2e23e220, 0x60be, 0x11d3, {0x8c, 0x4a, 0x00, 0x00, 0x64, 0x65, 0x73, 0x74}}
  51.  
  52. #define NS_DECL_NSLOCALFILE_UNICODE_METHODS                                                      \
  53.     nsresult AppendUnicode(const PRUnichar *aNode);                                              \
  54.     nsresult GetUnicodeLeafName(PRUnichar **aLeafName);                                          \
  55.     nsresult SetUnicodeLeafName(const PRUnichar *aLeafName);                                     \
  56.     nsresult CopyToUnicode(nsIFile *aNewParentDir, const PRUnichar *aNewLeafName);               \
  57.     nsresult CopyToFollowingLinksUnicode(nsIFile *aNewParentDir, const PRUnichar *aNewLeafName); \
  58.     nsresult MoveToUnicode(nsIFile *aNewParentDir, const PRUnichar *aNewLeafName);               \
  59.     nsresult GetUnicodeTarget(PRUnichar **aTarget);                                              \
  60.     nsresult GetUnicodePath(PRUnichar **aPath);                                                  \
  61.     nsresult InitWithUnicodePath(const PRUnichar *aPath);                                        \
  62.     nsresult AppendRelativeUnicodePath(const PRUnichar *aRelativePath);
  63.  
  64. // nsXPComInit needs to know about how we are implemented,
  65. // so here we will export it.  Other users should not depend
  66. // on this.
  67.  
  68. #include <errno.h>
  69. #include "nsILocalFile.h"
  70.  
  71. #ifdef XP_WIN
  72. #include "nsLocalFileWin.h"
  73. #elif defined(XP_MACOSX)
  74. #include "nsLocalFileOSX.h"
  75. #elif defined(XP_MAC)
  76. #include "nsLocalFileMac.h"
  77. #elif defined(XP_UNIX) || defined(XP_BEOS)
  78. #include "nsLocalFileUnix.h"
  79. #elif defined(XP_OS2)
  80. #include "nsLocalFileOS2.h"
  81. #else
  82. #error NOT_IMPLEMENTED
  83. #endif
  84.  
  85. #define NSRESULT_FOR_RETURN(ret) (((ret) < 0) ? NSRESULT_FOR_ERRNO() : NS_OK)
  86.  
  87. inline nsresult
  88. nsresultForErrno(int err)
  89. {
  90.     switch (err) {
  91.       case 0:
  92.         return NS_OK;
  93.       case ENOENT:
  94.         return NS_ERROR_FILE_TARGET_DOES_NOT_EXIST;
  95.       case ENOTDIR:
  96.         return NS_ERROR_FILE_DESTINATION_NOT_DIR;
  97. #ifdef ENOLINK
  98.       case ENOLINK:
  99.         return NS_ERROR_FILE_UNRESOLVABLE_SYMLINK;
  100. #endif /* ENOLINK */
  101.       case EEXIST:
  102.         return NS_ERROR_FILE_ALREADY_EXISTS;
  103. #ifdef EPERM
  104.       case EPERM:
  105. #endif /* EPERM */
  106.       case EACCES:
  107.         return NS_ERROR_FILE_ACCESS_DENIED;
  108.       default:
  109.         return NS_ERROR_FAILURE;
  110.     }
  111. }
  112.  
  113. #define NSRESULT_FOR_ERRNO() nsresultForErrno(errno)
  114.  
  115. void NS_StartupLocalFile();
  116. void NS_ShutdownLocalFile();
  117.  
  118. #endif
  119.